function request( data , method = 'get' , url , dataType = "text" , contentType = true , async = true ){
    return new Promise( (resolve)=>{
        ajax({
            url,
            data,
            async,
            method,
            dataType,
            contentType,
            success: res => {
                resolve(res);
            }
        });
    });
}

const loadFooter = data => request( data , 'post' , './footer.php' , 'text' );
const loadHeader = data => request( data , 'post' , './header.php' , 'text' );

const loadFooter1 = data => request( data , 'post' , './../../footer.php' , 'text' );
const loadHeader1 = data => request( data , 'post' , './../../header.php' , 'text' );

/**
 * 登录注册
 */
const register = data => request( data , 'post' , './php/login/register.php','json');
const login = data => request( data , 'post' , './php/login/login.php' , 'json' );

/**
 * 管理员用户管理
 */
const managementUser = data => request( data , 'post' ,  '../../php/admin/users/managementUser.php' , 'json');

const updateHtml = data => request( data , 'post' , '../../php/admin/userUpd.php' , 'text' );

/**
 * 管理员管理
 */
const adminMan = data => request( data , 'post' , '../../php/admin/users/adminMan.php' , 'json');

/** 
 * 类别添加
*/
const addCateHtml = data => request( data , 'post' , '../../php/admin/addCate.php' , 'text' );

const addSubeHtml = data => request( data , 'post' , '../../php/admin/addSub.php' , 'text' );

/**
 * 类别的选择框
 */

const cateSelect = data => request( data , 'post' , '../../php/admin/users/selectComm.php' , 'json' );
/**
 * 类别的修改获取数据
 */
const updCateHtml = data => request( data , 'post' , '../../php/admin/updCate.php' , 'text' );

const updSubeHtml = data => request( data , 'post' , '../../php/admin/updSub.php' , 'text' );

const getUpdCate = data => request( data , 'post' , '../../php/admin/users/selectComm.php' , 'json' );

/**
 * 类型
 */
const typeMan = data => request( data , 'post' , '../../php/admin/users/typeManage.php' , 'json' );

const addTypeHtml = data => request( data , 'post' , '../../php/admin/addType.php' , 'text' ) ; 

const updTypeHtml = data => request( data , 'post' , '../../php/admin/updType.php' , 'text');

/**
 * 商品
 */
const productMan = data => request( data , 'post' , '../../php/admin/users/productManage.php' , 'json' );

const productManFile = data => request( data , 'post' , '../../php/admin/users/productManage.php' , 'json' , false );

const addProdHtml = data => request( data , 'post' , '../../php/admin/addPro.php' , 'text' );

/**
 * 轮播图
 */
const tranImgMan = data => request( data , 'post' , '../../php/admin/users/transImgMan.php' , 'json' );

const addTransImgMan = data => request( data , 'post' , '../../php/admin/users/transImgMan.php' , 'json' , false );

const addTransImgHtml = data => request( data , 'post' , '../../php/admin/addTrImg.php' , 'text' );

/**
 * 
 * 主页
 */
const getList = data => request( data , 'post' , './php/index/index.php' , 'json' );

/**
 * 详情页
 */
const getDetail = data => request( data , 'post' , './../../php/index/detail.php' , 'json' );

/**
 * 购物车
 */
const getCarData = data => request( data , 'post' , './../../php/index/shopCart.php' , 'json' );